const app = getApp();
Page({
    data: {
        StatusBar: app.globalData.StatusBar,
        CustomBar: app.globalData.CustomBar,
        TabbarBot: app.globalData.tabbar_bottom,
        TabCur: 1,scrollLeft:0,
        SortMenu: [{id:1,name:"使用中"},{id:0,name:"已失效"}]
    },
    onLoad: function (options) {
        let _this = this;
        _this.vipList()
    },
    tabSelect(e) {
        console.log(e.currentTarget.dataset.id);
        this.setData({
            TabCur: e.currentTarget.dataset.id,
            scrollLeft: (e.currentTarget.dataset.id-1)*60
        })
        this.vipList()
    },
    vipList:function(){
      let _this = this
      wx.getStorage({
        key: 'user',
        success:(res) => {
          console.log(res)
            wx.request({
              method:'GET',
              url: 'http://localhost:8989/vipcard/lapse',
              data:{
                uid: res.data.uid,
                lapse: _this.data.TabCur
              },
              success:(res) => {
                _this.setData({
                  vipCardList: res.data.data
                })
                console.log(res)
              }
            })
        }
      })
    }
});
